package com.bizdk.fastfx;

import com.bizdk.fastfx.controller.LoginStageController;
import com.bizdk.fastfx.fxsupport.SpringContextHolder;
import com.bizdk.fastfx.fxsupport.StageManager;
import javafx.application.Application;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;

public class JavafxLauncher extends Application {

    @Override
    public void start(Stage stage) throws Exception {
        StageManager.register(stage);
        LoginStageController controller = SpringContextHolder.getBean(LoginStageController.class);
        Parent root = controller.getRoot();
        Scene scene = new Scene(root);
        controller.setStage(stage);
        controller.setScene(scene);
        stage.setScene(scene);
        stage.centerOnScreen();
        stage.show();
    }
}
